//动态加载一些资源


// wrap require api into promise
var requirePromise = function(path){
  // require('./template/'+ path);
  return new Promise(function(resolve, reject){
    require('./template/'+ path)
    require.ensure([], function() {
      var c = require('./template/'+ path);
      console.log(c);
      resolve(c);
    });
  });
}

// AMD Promise API
export default  {
  getTemplate: function(name){
    var requirePath;
    if (name) {
      // underscore template
      requirePath = name;
      return requirePromise(requirePath)
      .then(function(text){
        return text
      });
    }
  },

  getComponent: function(name) {
    var requirePath = './view/' + name;
    // return require(requirePath);
  },
  // async API for page loading
  // Login.json, Login.js, Login.css, Login.html


}
